<?php

use think\migration\Migrator;
use think\migration\db\Column;

class OrderLog extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        //创建商铺订单日志(company_order_log)表
        $this->table("company_order_log", ['comment' => '订单日志表'])
             ->addColumn('company_order_id', 'integer', ['limit' => 10, 'default' => 0, 'after' => 'id', 'comment' => '公司订单id'])
             ->addColumn('order_status', 'integer', ['limit' => 1, 'default' => 1, 'after' => 'company_order_id', 'comment' => '状态 1:待审核,2:待签收,3:待上架,4:审核拒绝,5:已完成'])
             ->addColumn('remark', 'string', ['limit' => 1000, 'after' => 'order_status', 'comment' => '备注'])
             ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'after' => 'remark', 'comment' => '状态 1:正常,2:禁用'])
             ->addColumn('create_time', 'integer', ['limit' => 10, 'after' => 'status', 'default' => 0, 'comment' => '创建时间'])
             ->addColumn('update_time', 'integer', ['limit' => 10, 'after' => 'create_time', 'default' => 0, 'comment' => '更新时间'])
             ->addColumn('delete_time', 'integer', ['limit' => 10, 'after' => 'update_time', 'default' => 0, 'comment' => '删除时间'])
             ->create();
    }
}
